import type { InputRef } from "antd"
import { useRef } from "react"
import {useNavigate } from "react-router-dom"



const useSearchQuestion = ()=>{
  const inputRef = useRef<InputRef>(null)
  const navigate = useNavigate()
  



    //搜索事件
  const handleSearch =()=>{
    const keyword = (inputRef?.current?.nativeElement as HTMLInputElement)?.value
    navigate(`?keyword=${keyword}`)   
  }


  return {inputRef,handleSearch}
}



export default useSearchQuestion